#include<stdio.h>

int atoi(char*s)
{  int result;
int sign;
while (*s!='-'&&(*s<'0'||*s>'9'))
{s++;
}

if (*s=='-')
    sign=-1;
while (*s!='\0')
{   if(*s>='0'&&*s<='9')
    result=result*10+*s-'0';
    s++;
}
return sign*result;
}
int main()
{
    char s[]="-1a23";
    printf("%d\n",atoi(s));
    return 0;
}